﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WF_LoanAgreement.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.WF_LoanAgreement" %>

<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">  

    <script type="text/javascript" src="../../Scripts/DatePicker.js"> </script>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" /> 

    <script type="text/javascript">

        function onTextChange(sender) {
            if (sender.get_value() == "") {
                sender.set_text("");
            }
        }

        function openProjectDetails(id, amt_period) {
            radopen("WF_DetailLoanPayment.aspx?cont_seq=" + id + "&amt_period=" + amt_period, "ProjectDtls");
            return false;


        }

    </script>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" 
                                                LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow 
                id="ProjectDtls" 
                runat="server"
                showcontentduringload="false"
                VisibleStatusbar="false"
                title="รายละเอียดการชำระเงินกู้"
                width="1000px"
                Height="600px"        
                Modal="true"
                skin = "Vista"
                behaviors="Close">
            </telerik:RadWindow>
        </Windows>

        <Windows>
            <telerik:RadWindow 
                ID="RadWindow1"  
                DestroyOnClose = "true"               
                Modal ="true"                
                VisibleStatusbar ="false"
                runat="server">
            </telerik:RadWindow>
        </Windows>


    </telerik:RadWindowManager>
    
    <title>สัญญาการกู้เงิน</title>      
    
    <asp:panel ID="Panel6" runat="server" >
        <table width="1000" cellpadding="0" cellspacing="0">
            <tr>
                <td width="280" valign = "top">
                
                    <!-- <uc2:user ID="user1" runat="server" /> -->
                
                </td>
                <td width="20" >
            
            
                </td>
                <td>
                    <div class="moduleDivSlim700">
                        <div class="moduleDivBottom700">
        
                            <asp:Panel ID="Panel779" runat="server" Width="700px" ScrollBars="Auto">
                           
                  
                    
                                <table align = "center" width = "650px">
                                    <tr>
                                        <td align="left">
                                            ประเภทบุคลากร :
                                            <telerik:RadComboBox ID="ddlEmployeeType" 
                                                                 runat="server" AllowCustomText="true" 
                                                                 CausesValidation="false" DataTextField="Name" 
                                                                 DataValueField="Sequence" 
                                                                 AutoPostBack = "true"
                                                                 EmptyMessage="... เลือกประเภทบุคลากร ..." Filter="Contains" 
                                                                 OnClientTextChange=" onTextChange " Width="200px" 
                                                                 onselectedindexchanged="ddlEmployeeType_SelectedIndexChanged">
                                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator ID="v7" runat="server" 
                                                                        ControlToValidate="ddlEmployeeType" 
                                                                        ErrorMessage="*">
                                            </asp:RequiredFieldValidator>
                                            &nbsp;</td>
                                        <td>
                                            &nbsp;</td>
                                        
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                </table>
                                
                
                            </asp:Panel>
                        
                        </div>
                    </div>
            
                </td>

         
            </tr>
        </table>
          
          

          
       
           
              
        <table>
            <tr>
      
                <td colspan="3">
                    <div class="moduleDivSlim1000x450">
                        <div class="moduleDivBottom1000">
                            <table align="center" width="980px">
                                <tr>
                                    <td align="left" class="tableHeader">
                                        ข้อมูลสัญญาเงินกู้</td>
                                </tr>
                            </table>
                            <table width="980px" align="center">
                                <tr>
                                    <td>
                                        <asp:Panel ID="PanelGrid" runat="server" Height="410px" ScrollBars="Auto" 
                                                   Width="980px">
                                            <telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True" 
                                                             AllowFilteringByColumn="True" AllowMultiRowEdit="True" 
                                                             AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" 
                                                             AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True" 
                                                             GridLines="None" OnItemCommand="RadGrid2_ItemCommand" 
                                                             Skin="Outlook" Width="970px">
                                                <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" 
                                                                 ClientDataKeyNames="cont_seq" CommandItemDisplay="Top" 
                                                                 DataKeyNames="cont_seq" InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                                
                                                                 NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                                    <CommandItemTemplate>
                                                        <table width="100%">
                                                            <tr>
                                                                <td>
                                                                    <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                                                                    CommandName="InitInsert" 
                                                                                    Visible="<%#                !RadGrid2.MasterTableView.IsItemInserted && RadGrid2.EditIndexes.Count <= 0 %>"> <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                                                                                                                                                                       style="border: 0px; vertical-align: middle;" /> เพิ่มข้อมูลสัญญาเงินกู้</asp:LinkButton>
                                                                    &nbsp;&nbsp;
                                                                </td>
                                                                <td align="right">
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </CommandItemTemplate>
                                                    <RowIndicatorColumn>
                                                        <HeaderStyle Width="20px" />
                                                    </RowIndicatorColumn>
                                                    <ExpandCollapseColumn Visible="True">
                                                    </ExpandCollapseColumn>
                                                    <Columns>
                                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                                                                                       EditText="คลิกเพื่อแก้ไขข้อมูล">
                                                            <ItemStyle Width="15px" />
                                                        </telerik:GridEditCommandColumn>
                                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
                                                                                  ConfirmDialogType="RadWindow" ConfirmText="ลบข้อมูลที่เลือก?" 
                                                                                  Text="คลิกเพื่อลบข้อมูล" UniqueName="column1">
                                                            <HeaderStyle HorizontalAlign="Center" Width="10px" />
                                                            <ItemStyle HorizontalAlign="Center" Width="10px" />
                                                        </telerik:GridButtonColumn>
                                                        
                                                            
                                                    <telerik:GridBoundColumn 
                                                        DataField="emp_type_name" 
                                                        HeaderStyle-HorizontalAlign="Center" 
                                                        FilterControlWidth = "100%"
                                                        ShowFilterIcon ="false"
                                                        AutoPostBackOnFilter ="true"
                                                        HeaderText="ประเภทบุคลากร" 
                                                        UniqueName="cbEmployeeType">
                                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                    </telerik:GridBoundColumn>
                                                      
                                                    
                                                        <telerik:GridTemplateColumn
                                                            DataField="cont_ref_no" 
                                                            HeaderText = "เลขที่สัญญา"
                                                            FilterControlWidth = "100%"
                                                            AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" 
                                                            ShowFilterIcon="False">
                                                            <ItemTemplate>
                                                                <%#Eval("cont_ref_no") %>                        
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                                        </telerik:GridTemplateColumn>                                   
                                    
                                    
                                                        <telerik:GridBoundColumn 
                                 
                                                            DataField="cont_date" 
                                                            HeaderText = "วันที่ทำสัญญา"
                                                            FilterControlWidth = "100%"
                                                            AutoPostBackOnFilter="true" 
                                                            CurrentFilterFunction="Contains" 
                                                            ShowFilterIcon="False"
                                                            UniqueName="cont_date"
                                                            DataFormatString="{0:dd/MM/yyyy}"                                        
                                                            >
                                 
                                                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                            <ItemStyle HorizontalAlign="Center" />
                                                        </telerik:GridBoundColumn> 
                                    
                                                        <telerik:GridTemplateColumn AutoPostBackOnFilter="true" 
                                                                                    CurrentFilterFunction="Contains" 
                                                                                    DataField="full_name" 
                                                                                    FilterControlWidth="100%" 
                                                                                    HeaderStyle-HorizontalAlign = "Center"
                                                                                    HeaderText = "ชื่อ - สกุลผู้กู้"
                                                                                    ShowFilterIcon="false" 
                                                                                    UniqueName="full_name">
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="targetControl" runat="server" Text='<%#Eval("full_name") %>' 
                                                                                OnClientClick='<%#                string.Format("return openProjectDetails(\"{0}\",\"{1}\");", Eval("cont_seq"), Eval("amt_period")) %>'></asp:LinkButton>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>                                                                  
                                      
                                                               
                                                        <telerik:GridTemplateColumn 
                                                            DataField="amt_period_pay" 
                                                            FilterControlWidth = "100%"
                                                            AutoPostBackOnFilter ="true"
                                                            ShowFilterIcon ="false"
                                                            HeaderText="จำนวนงวด" 
                                                            UniqueName="amt_period_pay">
                                                            <ItemTemplate>
                                                                <%#Eval("amt_period_pay") %> 
                                                            </ItemTemplate>
                                                            <ItemStyle HorizontalAlign="Center" />
                                                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                                     
                           
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn 
                                                            DataField="cont_stat_name" 
                                                            FilterControlWidth = "100%"
                                                            AutoPostBackOnFilter ="true"
                                                            ShowFilterIcon ="false"
                                                            HeaderText="สถานะ" 
                                                            UniqueName="cont_stat_name">
                                                            <ItemTemplate >
                                                                <%#Eval("cont_stat_name") %> 
                                                            </ItemTemplate>
                                                            <ItemStyle HorizontalAlign="Center" />
                                                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                                     
                           
                                                        </telerik:GridTemplateColumn>
                                    
                                                        <telerik:GridTemplateColumn 
                                                            DataField="remarks" 
                                                            FilterControlWidth = "100%"
                                                            AutoPostBackOnFilter ="true"
                                                            ShowFilterIcon ="false"
                                                            HeaderText="หมายเหตุ" 
                                                            UniqueName="remarks">
                                                            <ItemTemplate>
                                                                <%#Eval("remarks") %> 
                                                            </ItemTemplate>
                                                            <HeaderStyle HorizontalAlign="Center" Width="150px" />                                                                     
                           
                                                        </telerik:GridTemplateColumn>    
                                                    
                                               
                                                
                                                    </Columns>
                                                    <EditFormSettings EditFormType="WebUserControl" 
                                                                      UserControlName="../UserControls/WF_LoanAgreement.ascx">
                                                        <EditColumn UniqueName="EditCommandColumn1">
                                                        </EditColumn>
                                                    </EditFormSettings>
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                </MasterTableView>
                                                <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" 
                                                                EnableRowHoverStyle="True" ReorderColumnsOnClient="True">
                                                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                                </ClientSettings>
                                            </telerik:RadGrid>
                                        </asp:Panel>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </td>
            </tr>
     
        </table>
    </asp:panel>

</asp:Content>